import {simplePost} from "../../../utils/request";
import {getLoginUser} from "../../../service/user";
import {showToastSuccess} from "../../../utils/tool";

Page({
    data: {
        nav:{
            title:"设置密码"
        },
        password:'',
        user:null,
    },
    onLoad: function (options) {
        (async () => {
            const user = await getLoginUser()
            this.setData({
                user:user,
                options:options||{},
            })
        })()
    },
    savePassword(){
        const {password} = this.data
        simplePost("/user/update",{
            password,
        }).then(r => {
            showToastSuccess("保存成功", {
                timeout:() => {
                    wx.navigateBack()
                }
            })

        })
    }
});
